package com.imooc.pan.storage.engine.minio.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Janson
 * @Description Minio 配置客户端
 * @Date 2023/7/25
 */
@Configuration
public class MinioConfig {
    @Value("${minio.endpoint}")
    private String endpoint;
    @Value("${minio.accessKey}")
    private String accessKey;
    @Value("${minio.secretKey}")
    private String secretKey;
    
    //存储普通文件
    @Value("${minio.bucket.files}")
    public String bucket_files;
    
    //存储视频
    @Value("${minio.bucket.videofiles}")
    public String bucket_video;
    
    @Bean
    public MinioClient minioClient() {
        
        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint(endpoint)
                        .credentials(accessKey, secretKey)
                        .build();
        return minioClient;
    }
    
    
}
